9e5e28b96edf4185a59ca952880ffd2fe0195339,core/languageDesign/plugin/source/jetbrains/mps/runconfigs/RunConfigManager.java,RunConfigManager,disposeRunConfigs,#,145

Before Change


  public void disposeRunConfigs() {
    //assert ThreadUtils.isEventDispatchThread() : "should be called from EDT only";
    assert !myProject.isDisposed();
    if (!myLoaded) return;

    ExecutionManager executionManager = myProject.getComponent(ExecutionManager.class);
    RunContentManagerImpl contentManager = (RunContentManagerImpl) executionManager.getContentManager();
    for (RunContentDescriptor d : contentManager.getAllDescriptors()) {
      if (d.getAttachedContent() == null) {
        LOG.warning("Attached content of descriptor " + d.getDisplayName() + " is null.");
      } else if (d.getAttachedContent().getManager() == null) {
        LOG.warning("Manager of attached content of descriptor " + d.getDisplayName() + " is null.");
      } else {
        d.getAttachedContent().getManager().removeAllContents(true);
      }
    }

    synchronized (myConfigsLock) {
      final ExtensionPoint<RuntimeConfigurationProducer> epCreator = Extensions.getArea(null).getExtensionPoint(RuntimeConfigurationProducer.RUNTIME_CONFIGURATION_PRODUCER);
      RuntimeConfigurationProducer[] extensions = epCreator.getExtensions();
      for (RuntimeConfigurationProducer producer : extensions) {
        epCreator.unregisterExtension(producer);
        myRegisteredCreators.remove(producer);
      }

      Collections.reverse(mySortedConfigs);

      Element newState = new Element("root");
      try {
        getRunManager().writeExternal(newState);
        myState = newState;
      } catch (WriteExternalException e) {
        LOG.error(e);
      }

      getRunManager().clearAll();

      final ExtensionPoint<ConfigurationType> epConfigType = Extensions.getArea(null).getExtensionPoint(ConfigurationType.CONFIGURATION_TYPE_EP);
      ModelAccess.instance().runReadAction(new Runnable() {

After Change


      LOG.error(e);
    }

    getRunManager().clearAll();

    mySharedState = getSharedConfigurationManager().getState();
    reInitializeManagers();